<div class="well col-sm-12">
    <h4>Thông tin chuyến bay</h4>
    <div class="col-sm-2"><p><b>Tuyến bay: </b></p></div>
    <div class="col-sm-10"><p><?=$tuyenbay?></p></div>
    <div class="col-sm-2"><p><b>Chuyến bay: </b></p></div>
    <div class="col-sm-10"><p><?=$chuyenbay?></p></div>
    <div class="col-sm-2"><p><b>Thời gian: </b></p></div>
    <div class="col-sm-10"><p><?=$ngaybay.' '.$thoigian?></p></div>
    <div class="col-sm-2"><p><b>Máy bay: </b></p></div>
    <div class="col-sm-10"><p><?=$maybay?></p></div>
    <div class="col-sm-2"><p><b>Loại vé: </b></p></div>
    <div class="col-sm-10"><p><?=$loaive?></p></div>
</div>

<div class="form">
    <?php $attributes=array('id'=>'oneway_submit','class'=>'form-horizontal');
        echo form_open('',$attributes);?>
        <div class="form-group">
            <h4 class="col-sm-11 col-sm-offset-1">Số lượng hành khách: <?=$adult+$children?></h4>
        </div>
    
    <input type="hidden" id="adult" name="adult" value="<?=$adult?>">
    <input type="hidden" id="children" name="children" value="<?=$children?>">
    <input type="hidden" name="MSCB" value="<?=$chuyenbay?>">
    <input type="hidden" name="loaive" value="<?=$maloaive?>">
    <br/>
    <br/>
    <?php for($i=0;$i<$adult;$i++):?>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" >Hành khách:</label>
            <label class="col-sm-8" ><?=$i+1?></label>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" >Loại vé:</label>
            <label class="col-sm-8" >Người lớn</label>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" for="soghe_nl<?=$i?>">Chọn ghế</label>
            <div class="col-sm-8">
                <select class="form-control" name="soghe_nl<?=$i?>" id="soghe<?=$i?>" required>
                    <option value="" disabled selected>chọn ghế...</option>
                    <?php  foreach ($list_ghetrong as $row):?>
                    <option value="<?=$row['GHESO']?>"><?=$row['GHESO']?></option>
                    <?php  endforeach;?>
                </select>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" for="fullname_nl<?=$i?>">Tên đầy đủ</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="fullname_nl<?=$i?>" placeholder="Nhập tên đầy đủ..." required>
            </div>
        </div>
        <div class="col-sm-5">
            <label class="col-sm-4" for="ngaysinh_nl<?=$i?>">Ngày sinh</label>
            <div class="col-sm-8">
            <input class="form-control" type="date" name="ngaysinh_nl<?=$i?>" required>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" for="gioitinh_nl<?=$i?>">Giới tính</label>
            <div class="col-sm-8">
            <select class="form-control" name="gioitinh_nl<?=$i?>">
                <option value="Nam" selected>Nam</option>
                <option value="Nu">Nữ</option>
            </select>
            </div>
        </div>
        <div class="col-sm-5">
            <label class="col-sm-4" for="diachi_nl<?=$i?>">Địa chỉ</label>
            <div class="col-sm-8">
            <input class="form-control" type="text" name="diachi_nl<?=$i?>" placeholder="Nhập dịa chỉ..." required>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" for="CMND_nl<?=$i?>">CMND</label>
            <div class="col-sm-8">
            <input class="form-control" type="text" name="CMND_nl<?=$i?>" placeholder="Nhập số CMND..." required>
            </div>
        </div>
        <div class="col-sm-5">
            <label class="col-sm-4" for="passport_nl<?=$i?>">Passport</label>
            <div class="col-sm-8">
            <input class="form-control" type="text" name="passport_nl<?=$i?>" placeholder="Nhập Passport..." required>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" for="quocgia_nl<?=$i?>">Quốc tịch</label>
            <div class="col-sm-8">
            <input class="form-control" type="text" name="quocgia_nl<?=$i?>" placeholder="Nhập tên quốc gia..." required>
            </div>
        </div>
        <div class="col-sm-5">
            <label class="col-sm-4" for="sdt_nl<?=$i?>">Số điện thoại</label>
            <div class="col-sm-8">
            <input class="form-control" type="text" name="sdt_nl<?=$i?>" placeholder="+84..." required pattern="\+84[0-9]{9}[0-9]?">
            </div>
        </div>
    </div>
    <br/>
    <br/>
    <?php endfor;?>
    
    <?php for($i=0;$i<$children;$i++):?>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" >Hành khách:</label>
            <label class="col-sm-8" ><?=$i+1+$adult?></label>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" >Loại vé:</label>
            <label class="col-sm-8" >Trẻ em</label>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" for="soghe_te<?=$i?>">Chọn ghế</label>
            <div class="col-sm-8">
                <select class="form-control" name="soghe_te<?=$i?>" id="soghe<?=$i+$adult?>" required>
                    <option value="" disabled selected>chọn ghế...</option>
                    <?php  foreach ($list_ghetrong as $row):?>
                    <option value="<?=$row['GHESO']?>"><?=$row['GHESO']?></option>
                    <?php  endforeach;?>
                </select>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" for="fullname_te<?=$i?>">Tên đầy đủ:</label>
            <div class="col-sm-8">
            <input class="form-control" type="text" name="fullname_te<?=$i?>" placeholder="Nhập tên đầy đủ..." required>
            </div>
        </div>
        <div class="col-sm-5">
            <label class="col-sm-4"  for="ngaysinh_te<?=$i?>">Ngày sinh</label>
            <div class="col-sm-8">
            <input class="form-control" type="date" name="ngaysinh_te<?=$i?>" required>
            </div>
        </div>
    </div>
    <div class="form-group">   
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" for="gioitinh_te<?=$i?>">Giới tính</label>
            <div class="col-sm-8">
                <select class="form-control" name="gioitinh_te<?=$i?>">
                    <option value="Nam" selected>Nam</option>
                    <option value="Nu">Nữ</option>
                </select>
            </div>
        </div>
        <div class="col-sm-5">
            <label class="col-sm-4" for="diachi_te<?=$i?>">Địa chỉ</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="diachi_te<?=$i?>" placeholder="Nhập dịa chỉ..." required>
            </div>
        </div>
    </div>
    <div class="form-group">   
        <div class="col-sm-5 col-sm-offset-1">
            <label class="col-sm-4" for="quocgia_te<?=$i?>">Quốc tịch</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="quocgia_te<?=$i?>" placeholder="Nhập tên quốc gia..." required>
            </div>
        </div>
        <div class="col-sm-5">
            <label class="col-sm-4" for="MSNGH_te<?=$i?>">Người lớn đi kèm</label>
            <div class="col-sm-8">
            <select class="form-control" name="MSNGH_te<?=$i?>">
                <?php for ($j=0;$j<$adult;$j++){
                   echo '<option value="'.$j.'">Hành khách '.($j+1).'</option>';
                }
                ?>
            </select>
           </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-10 col-sm-offset-1">
            <label class="col-sm-2" for="thongtinks_te<?=$i?>">Thông tin KS</label>
            <div class="col-sm-10">
                <textarea class="form-control" type="text" name="thongtinks_te<?=$i?>" placeholder="Nhập Thông tin khai sinh..."></textarea>
            </div>
        </div>
    </div>
    <br/>
    <br/>
    <?php endfor;?> 
    <div class="panel-body">
        <div class="panel panel-body panel-default">
            <div class="form-group">
                <p class="col-sm-12" style="text-align: center;"><?=$tuyenbay.' - '.$ngaybay;?></p>
            </div>
            <div class="form-group">
                 <label class="col-sm-2">Tổng: </label>
                 <label class="col-sm-10"><?=$totalcost;?> VNĐ</label>
            </div>
            <div class="form-group">
                <label class="col-sm-2" for="mess">Lời nhắn</label>
                <div class="col-sm-10">
                    <textarea class="form-control" style="resize: vertical;" name="mess" placeholder="Để lại lời nhắn..."></textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <input type="submit" class="btn btn-primary" style="margin-left: 45%" value="Continue">
    </div>
    <?php echo form_close();?>
</div>
<style>
    .modal-header{
        border-top-left-radius: 5px;
        border-top-right-radius: 5px;
    }
</style>
<div id="modal_error" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
      <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header bg-danger">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="modal_label">Error</h4>
            </div>
            <div class="modal-body" id="modal_content">
              Khách hàng chọn ghế trùng nhau
             </div>
        </div>
      </div>
    </div>